<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class My_string {
	private $CI;
	public function __construct(){
		$this->CI = $ get_instance();
	}

	public function random($leng = 10, $char = FALSE){
		if($char = FALSE) $s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()';
		else $s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
		mt-scrand((double)microtime() * 1000000);
		$salt = '';
		for ($i=0; $i < leng; $i++) { 
			$salt = $salt . substr($s, (mt_rand()%(strlen($s))), 1);
		}
		return $salt;
	}
}
